function [ X, Y , Yr] = inputgen(func, range_start, range_end, distribution, dispersion, test_count)
%INPUTGEN generating input data for regression
%   inputgen(func, range_start, range_end, distribution, dispersion, test_count)
%   
X = range_start+rand(1,test_count).*(range_end-range_start);
X = sort(X');

switch distribution
    case 'normal'
        E = dispersion.*randn(test_count,1);
    case 'uniform'
        E = dispersion.*rand(test_count,1)-dispersion/2;
    otherwise 
        error('Unknown distribution');
end
Yr = eval(func);
Y = Yr +E;
end

